package com.zoagroup.funzy.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the type_msg database table.
 * 
 */
@Entity
@Table(name="type_msg")
public class TypeMsg implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="id_type_msg", unique=true, nullable=false)
	private Integer idTypeMsg;

	private String description;

	//bi-directional many-to-one association to Message
	@OneToMany(mappedBy="typeMsgBean",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	private List<Message> messages;

	public TypeMsg() {
	}

	public Integer getIdTypeMsg() {
		return this.idTypeMsg;
	}

	public void setIdTypeMsg(Integer idTypeMsg) {
		this.idTypeMsg = idTypeMsg;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<Message> getMessages() {
		return this.messages;
	}

	public void setMessages(List<Message> messages) {
		this.messages = messages;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((idTypeMsg == null) ? 0 : idTypeMsg.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TypeMsg other = (TypeMsg) obj;
		if (idTypeMsg == null) {
			if (other.idTypeMsg != null)
				return false;
		} else if (!idTypeMsg.equals(other.idTypeMsg))
			return false;
		return true;
	}
}